package com.zbkj.dal.base.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;
import org.apache.commons.lang3.StringUtils;

import java.util.Arrays;

@Getter
@AllArgsConstructor
public enum QuotaChangeStatusEnums {

    EFFICACY("EFFICACY", "有效"),
    LOSE_EFFICACY("LOSE_EFFICACY", "失效"),
    ;
    private final String code;
    private final String desc;

    public static String getDescByCode(String code) {
        if (StringUtils.isBlank(code)) {
            return null;
        }
        return Arrays.stream(QuotaChangeStatusEnums.values()).filter(t -> StringUtils.equals(t.getCode(), code)).map(QuotaChangeStatusEnums::getDesc).findFirst().orElse(null);
    }

}
